1 /*
2  * dmx.h
3  *
4  * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5  *                  & Ralph  Metzler <ralph@convergence.de>
6  *                    for convergence integrated media GmbH
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  *
22  */
23 
24 module libdvbv5_d.linux_dmx;
25 
26 
27 import core.sys.posix.sys.ioctl: _IO, _IOR, _IOW;
28 
29 extern (C):
30 
31 enum DMX_FILTER_SIZE = 16;
32 
33 enum dmx_output
34 {
35     DMX_OUT_DECODER = 0, /* Streaming directly to decoder. */
36     DMX_OUT_TAP = 1, /* Output going to a memory buffer */
37     /* (to be retrieved via the read command).*/
38     DMX_OUT_TS_TAP = 2, /* Output multiplexed into a new TS  */
39     /* (to be retrieved by reading from the */
40     /* logical DVR device).                 */
41     DMX_OUT_TSDEMUX_TAP = 3 /* Like TS_TAP but retrieved from the DMX device */
42 }
43 
44 alias dmx_output_t = dmx_output;
45 
46 enum dmx_input
47 {
48     DMX_IN_FRONTEND = 0, /* Input from a front-end device.  */
49     DMX_IN_DVR = 1 /* Input from the logical DVR device.  */
50 }
51 
52 alias dmx_input_t = dmx_input;
53 
54 enum dmx_ts_pes
55 {
56     DMX_PES_AUDIO0 = 0,
57     DMX_PES_VIDEO0 = 1,
58     DMX_PES_TELETEXT0 = 2,
59     DMX_PES_SUBTITLE0 = 3,
60     DMX_PES_PCR0 = 4,
61 
62     DMX_PES_AUDIO1 = 5,
63     DMX_PES_VIDEO1 = 6,
64     DMX_PES_TELETEXT1 = 7,
65     DMX_PES_SUBTITLE1 = 8,
66     DMX_PES_PCR1 = 9,
67 
68     DMX_PES_AUDIO2 = 10,
69     DMX_PES_VIDEO2 = 11,
70     DMX_PES_TELETEXT2 = 12,
71     DMX_PES_SUBTITLE2 = 13,
72     DMX_PES_PCR2 = 14,
73 
74     DMX_PES_AUDIO3 = 15,
75     DMX_PES_VIDEO3 = 16,
76     DMX_PES_TELETEXT3 = 17,
77     DMX_PES_SUBTITLE3 = 18,
78     DMX_PES_PCR3 = 19,
79 
80     DMX_PES_OTHER = 20
81 }
82 
83 alias dmx_pes_type_t = dmx_ts_pes;
84 
85 enum DMX_PES_AUDIO = dmx_ts_pes.DMX_PES_AUDIO0;
86 enum DMX_PES_VIDEO = dmx_ts_pes.DMX_PES_VIDEO0;
87 enum DMX_PES_TELETEXT = dmx_ts_pes.DMX_PES_TELETEXT0;
88 enum DMX_PES_SUBTITLE = dmx_ts_pes.DMX_PES_SUBTITLE0;
89 enum DMX_PES_PCR = dmx_ts_pes.DMX_PES_PCR0;
90 
91 struct dmx_filter
92 {
93     ubyte[DMX_FILTER_SIZE] filter;
94     ubyte[DMX_FILTER_SIZE] mask;
95     ubyte[DMX_FILTER_SIZE] mode;
96 }
97 
98 alias dmx_filter_t = dmx_filter;
99 
100 struct dmx_sct_filter_params
101 {
102     ushort pid;
103     dmx_filter_t filter;
104     uint timeout;
105     uint flags;
106 }
107 
108 enum DMX_CHECK_CRC = 1;
109 enum DMX_ONESHOT = 2;
110 enum DMX_IMMEDIATE_START = 4;
111 enum DMX_KERNEL_CLIENT = 0x8000;
112 
113 struct dmx_pes_filter_params
114 {
115     ushort pid;
116     dmx_input_t input;
117     dmx_output_t output;
118     dmx_pes_type_t pes_type;
119     uint flags;
120 }
121 
122 struct dmx_caps
123 {
124     uint caps;
125     int num_decoders;
126 }
127 
128 alias dmx_caps_t = dmx_caps;
129 
130 enum dmx_source
131 {
132     DMX_SOURCE_FRONT0 = 0,
133     DMX_SOURCE_FRONT1 = 1,
134     DMX_SOURCE_FRONT2 = 2,
135     DMX_SOURCE_FRONT3 = 3,
136     DMX_SOURCE_DVR0 = 16,
137     DMX_SOURCE_DVR1 = 17,
138     DMX_SOURCE_DVR2 = 18,
139     DMX_SOURCE_DVR3 = 19
140 }
141 
142 alias dmx_source_t = dmx_source;
143 
144 struct dmx_stc
145 {
146     uint num; /* input : which STC? 0..N */
147     uint base; /* output: divisor for stc to get 90 kHz clock */
148     ulong stc; /* output: stc in 'base'*90 kHz units */
149 }
150 
151 enum DMX_START = _IO('o', 41);
152 enum DMX_STOP = _IO('o', 42);
153 enum DMX_SET_BUFFER_SIZE = _IO('o', 45);
154 enum DMX_GET_PES_PIDS = _IOR!(ushort[5])('o', 47);
155 enum DMX_GET_CAPS = _IOR!dmx_caps_t('o', 48);
156 enum DMX_SET_SOURCE = _IOW!dmx_source_t('o', 49);
157 enum DMX_ADD_PID = _IOW!ushort('o', 51);
158 enum DMX_REMOVE_PID = _IOW!ushort('o', 52);
159 
160 /* _DVBDMX_H_ */